package com.ssyan.decorator;

/**
 * @author ssyan
 * @Description TODO
 * @create 2021/8/29 1:21
 * @Version 1.0
 */
public class Decorator extends Drink{

    private Drink obj;

    public Decorator(Drink obj) {
        this.obj = obj;
    }

    @Override
    public float cost() {
        //getPrice 自己价格
        return super.getPrice()+obj.cost();
    }

    @Override
    public String getDesc() {
        //输出了被装饰者的信息
        return super.desc+""+super.getPrice()+"&&"+obj.getDesc();
    }
}
